/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.rec.be;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "REC_CONDONACION")
@NamedQueries({@NamedQuery(name = "Condonacion.findAll", query = "SELECT c FROM Condonacion c"), @NamedQuery(name = "Condonacion.findByIdCondonacion", query = "SELECT c FROM Condonacion c WHERE c.idCondonacion = :idCondonacion")})
public class Condonacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_CONDONACION", nullable = false)
    private Integer idCondonacion;
    @JoinColumns({@JoinColumn(name = "FID_REC_CARTERA", referencedColumnName = "ID_CARTERA"), @JoinColumn(name = "FID_REC_CREDITO", referencedColumnName = "ID_CREDITO")})
    @ManyToOne(fetch = FetchType.LAZY)
    private CreditoCartera creditoCartera;

    public Condonacion() {
    }

    public Condonacion(Integer idCondonacion) {
        this.idCondonacion = idCondonacion;
    }

    public Integer getIdCondonacion() {
        return idCondonacion;
    }

    public void setIdCondonacion(Integer idCondonacion) {
        this.idCondonacion = idCondonacion;
    }

    public CreditoCartera getCreditoCartera() {
        return creditoCartera;
    }

    public void setCreditoCartera(CreditoCartera creditoCartera) {
        this.creditoCartera = creditoCartera;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCondonacion != null ? idCondonacion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Condonacion)) {
            return false;
        }
        Condonacion other = (Condonacion) object;
        if ((this.idCondonacion == null && other.idCondonacion != null) || (this.idCondonacion != null && !this.idCondonacion.equals(other.idCondonacion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.rec.be.Condonacion[idCondonacion=" + idCondonacion + "]";
    }

}
